Skip to content

feat(ci): verify agent trust and preserve generated API contracts - #384

Merged
dodeja merged 12 commits into
mainfrom
cursor/land-agent-trust-main-c4b3
Oct 18, 2026
Merged

dodeja merged 12 commits into
mainfrom
cursor/land-agent-trust-main-c4b3

Conversation

@dodeja

@dodeja dodeja commented Sep 27, 2026 •

Copy link
Copy Markdown
Member

Adds a repository verifier for agent-authored changes, plus the advisory trust and risk policy from #383, which was squash-merged into this branch.

Verifier. npm run check:agent-trust runs in CI before vp run check. It checks that skills/agent-trust/feature-map.json matches the 14 registered MCP tools and their implementation paths, the public SDK exports, and every page in the SDK/MCP docs navigation. Every registerTool call in server.ts counts as a registration, whatever its receiver. A registration form the guard cannot read fails with its source line. The verifier also checks workspace toolchain ownership. It finds workspaces from the root workspaces globs and skips node_modules, as npm does. Last, it checks that the generated SDK and MCP OpenAPI artifacts match docs/openapi.json. npm run agent-verify runs the full local sequence.

The Postman collection is not drift-checked. Its generator is not deterministic: two runs on the same spec differ by about 1,300 lines of random UUIDs and enum examples. generate_postman.yml regenerates the collection on every push that changes docs/openapi.json.

Generated contract test. sdks/typescript-sdk/src/generated-contract.test.ts compiles consumers against the generated types and pins the container resource discriminant.

Advisory trust policy (from #383). This adds .github/workflows/trust-policy.yml, shadow-risk.yml, trust-review-signal.yml and .github/CODEOWNERS. It also adds the scripts/ci/ risk classifier, config reader, trust reconciler and shadow scorer, tested under npm run test:risk-policy. The reconciler gives each PR a 60s deadline. A stalled GitHub request fails that PR, aborts its pending label writes, keeps its report out of the job summary, and lets the sweep move on to the next PR.

Docs. The list filter reference keeps the SEO title and description from #421 in its generator. Agent guidance lives in skills/agent-trust/, .cursor/rules/ and a short AGENTS.md section.

This PR does not change docs/openapi.json, add an API reference page, or change any MCP tool. The generated Postman collection matches main.

Verification. On head df81cbd, local runs passed npm run test:agent-trust (58), npm run test:risk-policy (49), npm run check:agent-trust and vp check. The reconciler deadline was also tested against the real @actions/github v6 client and a local server that never answers. In CI, every check passes except the authenticated "MCP preview 2026-07-28" gate. That gate fails because the shared MCP_EVAL_TOKEN credential is rejected, not because of this code.

Remaining gates.

  • This PR needs a human review on its current head.
  • The trust-policy workflows run only from the default branch (pull_request_target and schedule), so the reconciler has not run live. Its first live sweep happens after merge.
  • The MCP preview credential needs fixing separately.

Before merging. Three commit messages on this branch contain [skip ci]: Postman bot commits 8b41bb4 and 880cfaf, and a bullet in the body of the #383 squash e909f5d. The repository builds squash messages from commit messages. Remove those lines from the squash message, or main skips CI, Postman generation and release-please.

🤖 Generated with Claude Code

@mintlify

mintlify Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
terminal49 🟢 Ready View Preview Oct 14, 2026, 4:56 AM

@vercel

vercel Bot commented Sep 27, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
api Ready Ready Preview Oct 17, 2026 6:50pm UTC

Request Review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-17T18:52:09.200289Z df81cbd New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8c24582a6e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bin/check-agent-trust.mjs Outdated
Comment thread sdks/typescript-sdk/src/generated/terminal49.ts Outdated
Comment thread docs/openapi.json Outdated
Comment thread bin/check-agent-trust.mjs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 03019365fa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sdks/typescript-sdk/src/generated/terminal49.ts Outdated
Comment thread docs/openapi.json Outdated
Comment thread bin/check-agent-trust.mjs Outdated
@dodeja dodeja changed the title feat: land agent trust stack on main feat(ci): add and verify the agent trust foundation Oct 6, 2026
@dodeja dodeja changed the title feat(ci): add and verify the agent trust foundation feat(ci): verify agent trust and preserve generated API contracts Oct 6, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8594722586

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bin/agent-verify.mjs

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4bcea9bab7

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bin/check-agent-trust.mjs
Comment thread bin/check-agent-trust.mjs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0f5312ab72

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bin/check-agent-trust.mjs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2245417b57

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/openapi.json Outdated
Comment thread docs/openapi.json Outdated
Comment thread bin/check-agent-trust.mjs Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4241fb6b4e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bin/agent-verify.mjs
]),
{
name: 'OpenAPI SDK type generation',
command: ['node', 'bin/check-openapi-types.mjs'],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Verify generated MCP filter schemas in the completion gate

When an OpenAPI filter description or validation rule changes and the canonical SDK generator is run, this step verifies only the SDK artifacts; no agent-verify step regenerates and compares packages/mcp/src/generated/list-filter-schemas.ts. The workspace build and tests consume that stale file, so the required handoff gate can pass while the MCP tool schemas still expose outdated metadata or validation. Run the MCP filter generator in isolation and compare its output as part of this gate.

AGENTS.md reference: AGENTS.md:L51-L54

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in f1b3629. bin/check-openapi-types.mjs now also runs packages/mcp/scripts/generate-list-filter-schemas.mjs in its temporary checkout and diffs packages/mcp/src/generated/list-filter-schemas.ts. agent-verify runs that check, and so does the new CI step (npm run check:agent-trust). bin/check-openapi-types.test.mjs has a new case, rejects drift in packages/mcp/src/generated/list-filter-schemas.ts. It fails against the old checker and passes with the fix.

Comment thread bin/check-agent-trust.mjs
Comment on lines +142 to +143
if (options.incremental || options.composite)
options.tsBuildInfoFile = join(temporary, 'build.tsbuildinfo');

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Allow the temporary TypeScript build-info output

When the SDK enables incremental or composite, this assigns tsBuildInfoFile under the temporary directory, but program.emit passes that .tsbuildinfo file through the same write callback; the callback then rejects it for being outside the configured dist directory. Consequently, agent-verify fails for either otherwise-valid compiler option despite this branch attempting to support them. Handle the build-info output separately from package artifacts.

AGENTS.md reference: AGENTS.md:L82-L82

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in f1b3629. You were right. The new tests accepts incremental SDK builds whose build info stays out of dist and accepts composite SDK builds whose build info stays out of dist failed with SDK compiler output escaped configured dist: .../build.tsbuildinfo. The emit callback now skips the configured tsBuildInfoFile. The SDK tsconfig sets neither option today, so CI was not affected.

dodeja and others added 3 commits October 16, 2026 23:56
`npm run agent-verify` is the local completion gate. It runs the agent
trust guards, the Vite+ and TypeScript checks, every workspace build and
test, the OpenAPI generation drift check, and the offline MCP protocol
smoke.

- bin/check-agent-trust.mjs keeps skills/agent-trust/feature-map.json in
  sync with the MCP tools registered in server.ts, the SDK package
  exports, and the MCP and SDK docs navigation. It also checks the
  vite-plus toolchain pins, the ordered workspace build, and that no
  workspace has its own Vite config.
- bin/check-openapi-types.mjs regenerates the SDK types, the SDK filter
  reference, and the MCP filter schemas from docs/openapi.json in a
  temporary checkout and fails on any drift.
- The feature map covers main as it is now: 14 tools (whoami included)
  and the Gemini and Antigravity setup guides.
- The guard skips the TypeScript build-info file when the SDK compiles
  incrementally or as a composite project. Before this, that file
  failed the dist check.
- CI runs the guards and the drift check as a new step in the toolchain
  job. The existing check, test, and build steps stay as they are.

Rebuilt on current main from #384's branch (head 4241fb6). The
/containers/{id}/route OpenAPI path, its schemas, and its reference page
are left out. Main removed those docs in 2792425.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Type-checks small consumer programs against the generated OpenAPI types.
A container payload with type "container" compiles. An account
discriminant is rejected with TS2322.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#421 edited the title and description in the generated list-filters.mdx
but not in the script that generates it. The next regeneration (#418)
put the old metadata back. This change moves #421's metadata into
generate-filter-types.mjs and regenerates the page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dodeja
dodeja force-pushed the cursor/land-agent-trust-main-c4b3 branch from 4241fb6 to c6a11cb Compare October 17, 2026 06:57
)

* feat(ci): reconcile advisory PR trust policy from current evidence

Add an advisory trust-policy controller that classifies changed paths by
risk, checks current-head human writer approvals and exact-attempt CI
evidence, and writes risk labels and summaries. It never authorizes a
merge; native branch protection stays the merge authority.

- trust-policy.yml, shadow-risk.yml and trust-review-signal.yml run
  trusted default-branch code only.
- scripts/ci holds the classifier, the shadow scorer, the read-only
  branch-protection checker and the reconciler, with regression tests.
- CODEOWNERS names owners for every high-risk path.
- npm test and agent-verify now run the policy tests.

Rebuilt from the reviewed history at 6b5f819 on top of the rebuilt
agent-trust base; the Postman bot commit is not carried over.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: add the trust-policy installation guide and GitHub trial

Keep the maintainer guides with the agent-trust skill and link them from
the paved path, so maintainers run the GitHub verification trial before
they change merge protection.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(ci): own every agent-trust verifier and drop moved guide paths

bin/check-openapi-types.test.mjs was classified medium risk and had no
CODEOWNERS entry, unlike the other verifier tests. The new test derives
the verifier list from bin/, so a future verifier cannot miss either.

The docs/risk-gates*.md entries pointed at guides that now live under
skills/agent-trust/, which the existing prefix rules already cover.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore: Auto-generate Postman collection from openapi.json [skip ci]

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
dodeja and others added 3 commits October 17, 2026 00:38
Brings in #434, #437 and #444. The only conflict was the generated
Terminal49-API.postman_collection.json. This branch does not change
docs/openapi.json, so it takes main's generated collection unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The generator assigns random request IDs and enum example values, so
each rerun rewrites about 640 lines of the collection from an unchanged
docs/openapi.json. This branch does not change the spec, so it carries
main's collection and the PR diff has no generated churn.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dodeja

dodeja commented Oct 17, 2026

Copy link
Copy Markdown
Member Author

Reconciled with main. History was not rewritten.

CI on ee2b7960: every job passes except MCP preview 2026-07-28, which stops at Fixture discovery list_shipments failed (HTTP 200, tool error: true); check eval credentials. Main's CI fails the same way because the shared eval credential is broken. That is a credential block, not a failure in this code. GitHub now reports the PR as MERGEABLE (UNSTABLE).

Locally on the merged tree, vp run check, npm test, npm run test:coverage and npm run check:agent-trust all pass.

The route-doc scope is unchanged. This branch adds no API reference page and does not change docs/openapi.json. I rewrote the description to match: it had claimed a route reference page, route link contract changes, 13 tools (there are 14), and that #383 would land later (it is already squashed in here).

Still open for a human:

  • Three commit messages on this branch contain [skip ci]: 8b41bb4f, 880cfaf3, and the body of e909f5db. Strip those lines from the squash message before merging, or main skips CI, Postman generation and release-please.
  • The three review threads that were answered as fixed still need the reviewer to resolve them.
  • trust-policy.yml and shadow-risk.yml trigger on pull_request_target, so they run from main's copy and cannot run on this PR until it merges.

🤖 Generated with Claude Code

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ee2b796004

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bin/check-agent-trust.mjs Outdated
Comment on lines +239 to +243
receiver &&
ts.isIdentifier(receiver) &&
receiver.text === 'server' &&
method === 'registerTool'
) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Detect registerTool calls made through aliases

When a tool is added through an alias such as const toolServer = server; toolServer.registerTool('new_tool', ...), this predicate ignores the registration because it compares the receiver's text only to server. After updating the runtime tool-count and behavior tests, the stale feature map can therefore still pass verification. The replacement AST guard is fresh evidence that the earlier registration-inventory issue remains for aliased receivers; resolve the receiver symbol or explicitly reject unsupported registerTool call forms.

AGENTS.md reference: AGENTS.md:L79-L81

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in cab4117. The inventory no longer looks at the receiver name. Every <receiver>.registerTool(...) or <receiver>['registerTool'](...) call in server.ts counts as a registration. Any other use of registerTool fails with the source line (Unsupported MCP registerTool form at packages/mcp/src/server.ts:N), so destructuring, .bind, or a key held in a variable cannot hide a tool.

New tests in bin/check-agent-trust.test.mjs run the real guard CLI against a temp repository:

  • registration through an alias is held to the feature map
  • registration through a reassigned receiver is held to the feature map
  • rejects the unsupported registration form for const { registerTool } = server, server.registerTool.bind(server), and server[method] with method = 'registerTool'

With the old checker restored, all 5 fail and the guard reports PASS for each unmapped tool. With the fix, all 57 agent-trust and OpenAPI-type tests pass and node bin/check-agent-trust.mjs still passes on the real server.ts. A built-up key such as server['register' + 'Tool'] is still not detected. The old checker missed it too.

The registration inventory only counted calls whose receiver was the
identifier `server`, so `const alias = server; alias.registerTool(...)`
or a reassigned receiver registered a tool the feature map never saw.

Every `<receiver>.registerTool(...)` call in server.ts now counts as a
registration whatever the receiver is. Any other use of `registerTool`
(destructuring, `.bind`, a computed key held in a variable) fails with
the source line, so a registration cannot hide behind an unsupported
form.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dodeja

dodeja commented Oct 17, 2026

Copy link
Copy Markdown
Member Author

Receipts for head cab4117 (fix(ci): hold aliased MCP registerTool calls to the feature map). The commit is GPG-signed, has no [skip ci], and was pushed fast-forward from ee2b796.

  • Fix: the Codex P2 about aliased registerTool receivers. Proof is in the thread reply: feat(ci): verify agent trust and preserve generated API contracts #384 (comment)
  • Tests: 57/57 in npm run test:agent-trust. The 5 new cases fail when the old checker is restored. The real guard passes.
  • Independent review of the exact commit (gpt-6-astra): no findings.
  • CI on cab4117: every check passes except MCP preview 2026-07-28. That job fails at fixture discovery (list_shipments returns a tool error) because the MCP_EVAL_TOKEN eval credential is broken. Main's eval fails the same way. This is a credential problem, not a code failure.
  • Unchanged: the route-doc scope, the review threads (none resolved), and the earlier [skip ci] commits in branch history. Human review is still required.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cab4117701

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +19 to +23
const artifacts = [
'sdks/typescript-sdk/src/generated/terminal49.ts',
'sdks/typescript-sdk/src/generated/list-filters.ts',
'docs/api-docs/api-reference/list-filters.mdx',
'packages/mcp/src/generated/list-filter-schemas.ts',

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Verify the generated Postman collection

When docs/openapi.json changes and the SDK/MCP generators are run, this artifact list still omits Terminal49-API.postman_collection.json, so both check:agent-trust and the required CI job can pass with a stale public collection. The existing Postman workflow runs only after a push, so it does not validate the reviewed commit; generate the collection in isolation and compare it here with the other OpenAPI-derived outputs.

AGENTS.md reference: AGENTS.md:L51-L54

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changing this. The Postman generator is not deterministic, so a byte-for-byte drift check against it would fail on every run.

Evidence. I ran the pinned generator from generate_postman.yml (openapi-to-postmanv2@6.3.0, -p -O folderStrategy=Tags,enableOptionalParameters=false) twice on this branch's docs/openapi.json:

  • The two outputs have different hashes (90e6cc17… and e4b10089…). Neither matches the committed collection (10f60934…).
  • diff run1.json run2.json shows 1286 changed lines from one identical input.
  • The changes are random request id UUIDs (e106f9d2-… vs ca655926-…) and randomly picked enum example values ("off_dock" vs "delivered").

Normalizing the output would mean dropping every id and every enum example. What remained would not tell a reviewer whether the collection is stale.

The collection is downstream output, not reviewed source. AGENTS.md lists it as generated, not to be hand-edited. generate_postman.yml regenerates and commits it on every push that touches docs/openapi.json, on any branch, PR branches included. This branch already has one of those bot commits (880cfaf). The gate keeps checking the deterministic OpenAPI outputs (SDK types, SDK filters, the filters MDX page, and the MCP filter schemas).

Comment thread bin/check-agent-trust.mjs Outdated
Comment on lines +324 to +328
globSync(
readJson('package.json').workspaces.map(
(workspace) => `${workspace}/package.json`,
),
{ cwd: root },

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Exclude dependencies when expanding recursive workspaces

When the root workspace configuration uses a recursive pattern such as sdks/**, appending /package.json and passing it directly to globSync also matches installed dependencies—for example, this checkout contains sdks/typescript-sdk/node_modules/openapi-fetch/package.json. Those packages are not npm workspaces, but the guard then requires their toolchain pins and root build entries, causing check:agent-trust to fail after a legitimate workspace-pattern change. The new glob-based implementation and the existing nested dependency manifests are fresh evidence beyond the earlier hard-coded-inventory issue; resolve manifests with npm workspace semantics or exclude node_modules.

AGENTS.md reference: AGENTS.md:L73-L73

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 5727805. You were right: globSync('sdks/**/package.json') returns sdks/typescript-sdk/node_modules/*/package.json too. workspaceManifests() now passes exclude: ['**/node_modules/**']. That is the same ignore npm applies when it maps workspaces (@npmcli/map-workspaces adds '**/node_modules/**' to its glob ignore list).

New test in bin/check-agent-trust.test.mjs, recursive workspace globs skip installed dependency manifests like npm. It sets the root workspaces to ['packages/*', 'sdks/**'], writes sdks/typescript-sdk/node_modules/openapi-fetch/package.json, and runs the real guard CLI against a temp repository.

  • With the old guard restored, it fails with FAIL agent trust guards: Cannot read properties of undefined (reading 'vite-plus').
  • With the fix, it passes. npm run test:agent-trust passes 58/58 and npm run check:agent-trust reports PASS on the real repo.

Negated workspace patterns (!path) are still not supported. The root manifest uses none today.

dodeja and others added 2 commits October 17, 2026 11:44
The toolchain guard appended /package.json to each root workspace pattern
and globbed it as-is, so a recursive pattern such as sdks/** also matched
installed dependency manifests (sdks/typescript-sdk/node_modules/*/package.json)
and failed on their missing toolchain pins. npm ignores **/node_modules/**
when it maps workspaces; the guard now does the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The advisory sweep awaited every PR in sequence, so one stalled GitHub
request could hold the job until its 20-minute timeout and starve every
later PR. Each PR now runs under an AbortController deadline. When it
fires, the PR is reported as failed, its in-flight direct request is
aborted, any later label write for that PR is rejected before it is sent,
and the sweep moves on to the next PR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A PR that hit its deadline could still finish later (a stalled paginated
call is not aborted) and append its report to the shared job summary,
next to the failure that said it timed out. Each PR now writes into its
own buffer, and only a PR that finishes within its deadline flushes it to
the job summary.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3ba50e5104

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bin/agent-verify.mjs
Comment on lines +42 to +43
name: 'Policy and workspace tests',
command: ['npm', 'test'],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Run coverage artifact checks in the completion gate

When an agent changes a coverage generator or its inputs without regenerating the published coverage artifacts, the required full npm run agent-verify can still pass: this step invokes npm test, whose root script does not include the separate test:coverage command, and no later step runs it either. Although the dedicated CI coverage job will catch this after handoff, the documented completion gate gives a false local success; include npm run test:coverage in the non-quick sequence.

AGENTS.md reference: AGENTS.md:L82-L82

Useful? React with 👍 / 👎.

Comment thread bin/agent-verify.mjs
Comment on lines +47 to +48
name: 'OpenAPI SDK and MCP generation',
command: ['node', 'bin/check-openapi-types.mjs'],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include generated SDK docs in the completion gate

When public SDK declarations or JSDoc change without running npm run sdk:docs, every agent-verify step can succeed because this generation check covers only the OpenAPI-derived files and nothing regenerates or compares docs/sdk/reference/**. The separate sdk-tooling CI job catches the drift later, but the required handoff gate incorrectly reports success with stale generated public documentation; run the canonical SDK docs generator in isolation and compare its outputs here.

AGENTS.md reference: AGENTS.md:L51-L55

Useful? React with 👍 / 👎.

@dodeja

dodeja commented Oct 17, 2026

Copy link
Copy Markdown
Member Author

Receipts for this pass. Head moved cab4117 -> 3ba50e5 -> df81cbd. All three commits are signed fast-forward pushes. Nothing was merged, closed, resolved, retargeted or force-pushed. The route-doc scope is unchanged.

Workspace globs (Codex P2, bin/check-agent-trust.mjs:328). Fixed in 5727805. The proof is in the thread: #384 (comment)

Postman drift (Codex P2, bin/check-openapi-types.mjs:23). Not changed. The pinned generator is not deterministic: two runs on the same spec differ by 1286 lines. The evidence is in the thread: #384 (comment)

Per-PR deadline (Codex review finding, scripts/ci/reconcile-trust.mjs:345-353; no inline thread). Fixed in 3ba50e5 and df81cbd.

  • Each PR in the trust sweep now has a 60s AbortController deadline. When it fires, the PR is reported as PR #N: reconciliation exceeded the 60000ms deadline. Its in-flight request is aborted, and any later label write for that PR is rejected before it is sent. The sweep then moves on.
  • df81cbd also gives each PR its own summary buffer. Only a PR that finishes within its deadline adds its report to the job summary. Both independent reviewers flagged that late summary write as a P3 on 3ba50e5.
  • Tests in scripts/ci/trust-policy.test.mjs:
    • a stalled PR request hits its deadline and the sweep reaches the next PR hits its 5s timeout on cab4117, because the sweep never reaches PR 11.
    • a PR that finishes after its deadline cannot add its report to the job summary fails on 3ba50e5.
    • Both pass on df81cbd.
  • I also ran the sweep against the real @actions/github v6 client with a local server that never answers GET /pulls/10. The sweep finished in 338 ms with a 300 ms deadline. It reached /pulls/11, and the process exited cleanly. A direct call with an aborted signal never reached the server.
  • Known limit: Octokit paginate() drops request.signal, so a stalled paginated call is not torn down. It cannot write labels or a report after its deadline.

Local results on df81cbd. npm run test:agent-trust 58/58, npm run test:risk-policy 49/49, npm run check:agent-trust PASS. vp check reports 0 errors, and its warning count is unchanged at 1277.

Independent review at df81cbd. Opus 5.5 and GPT-6 astra (xhigh) both returned no blockers. Opus reverted each fix and confirmed every new test fails without it. Remaining P3s are recorded, not fixed:

  • A sweep with about 20 stalled PRs would still reach the 20-minute job timeout. That limit already existed. Before this change, the first stall alone was enough.
  • A deadline that fires between removeLabel and addLabels leaves the PR with no risk:* label. This fails safe, and the next sweep repairs it.
  • An abandoned paginated socket stays open until undici's default timeouts.
  • The exclude glob option needs Node 22.14 or later. The repo pins Node 24.11.

CI on df81cbd. 22 checks pass. MCP preview 2026-07-28 fails on the rejected shared MCP_EVAL_TOKEN (Fixture discovery list_shipments failed ... check eval credentials). That is a separate provider block.

Not merge-ready. These gates remain:

  • human review on the current head;
  • the MCP eval credential;
  • the trust-policy workflows only run from the default branch, so their first live sweep happens after merge;
  • [skip ci] must be stripped from the squash message (8b41bb4, 880cfaf, and the e909f5d body).

@dodeja
dodeja merged commit 00fd834 into main Oct 18, 2026
27 of 28 checks passed
dodeja added a commit that referenced this pull request Oct 18, 2026
Brings in trade intelligence (#415) and the CI trust gates (#384).

The seven trade intelligence tools move into the tool registry under a new
`trade` toolset. It is on by default and stays on for the shared env token,
because every tool in it is read-only, so the default tools/list keeps
everything main serves today. Names, titles, descriptions, schemas and
annotations are unchanged. The per-account entitlement is still checked when
a tool runs, not when it is registered.

The server instructions keep main's trade guidance as their own paragraph,
dropped when the session does not serve the trade toolset.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch was successfully deployed

2 active (1 outdated) deployments
Preview — df81cbd0 Deployed Oct 17, 2026 by vercel[bot]
staging - docs — 9b285776 Deployed Oct 14, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant